package main.java.indi.zyj.lcweek;

public class MaxBottlesDrunk {
    public int maxBottlesDrunk(int numBottles, int numExchange) {

        int emptyBottles = numBottles, drunkBottles = numBottles;
        numBottles = 0;

        while (emptyBottles >= numExchange) {

            while (emptyBottles >= numExchange) {
                emptyBottles = emptyBottles - numExchange;
                numBottles++;
                numExchange++;
            }

            drunkBottles += numBottles;
            emptyBottles += numBottles;
            numBottles = 0;
        }
        return drunkBottles;
    }
}
